﻿//-----------------------------------------------------------------------
// <copyright file="SimplicityStrategy.cs" company="tuliprules.org">
//     Copyright (c) 2010 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the SimplicityStrategy class.</summary>
//-----------------------------------------------------------------------

namespace Tulip.Engine.ConflictResolution
{
    /// <summary>
    /// Simplicity conflict resolution strategy.
    /// </summary>
    /// <remarks>
    /// <para>Among productions of the same salience, newly activated productions are placed above all 
    /// activations of productions with equal or higher specificity. The specificity of a 
    /// production is determined by the number of comparisons that must be performed on the LHS 
    /// of the rule. Each comparison to a constant or previously bound variable adds one to the 
    /// specificity. Each function call made on the LHS of a rule as part of the :, =, or test 
    /// conditional element adds one to the specificity. The boolean functions and, or, and not 
    /// do not add to the specificity of a rule, but their arguments do. Function calls made 
    /// within a function call do not add to the specificity of a rule. For example, the 
    /// following rule</para>
    /// <para>(defrule example
    ///     (item ?x ?y ?x)
    ///     (test (and (numberp ?x) (&gt; ?x (+ 10 ?y)) (&lt; ?x 100)))
    ///     =&gt;)</para>
    /// <para>has a specificity of 5. The comparison to the constant item, the comparison of ?x to its 
    /// previous binding, and the calls to the numberp, &lt;, and &gt; functions each add one to the 
    /// specificity for a total of 5. The calls to the and and + functions do not add to the 
    /// specificity of the rule.</para>
    /// </remarks>
    public class SimplicityStrategy : ConflictResolutionStrategy
    {
        /// <summary>
        /// Factory method returns a new agenda.
        /// </summary>
        /// <returns>A new agenda.</returns>
        public override Agenda NewAgenda()
        {
            // TODO: return agenda here
            return null;
        }

        /// <summary>
        /// Factory method creates a new agenda list.
        /// </summary>
        /// <returns>A new agenda list.</returns>
        public override IAgendaList CreateAgendaList()
        {
            return null;
        }
    }
}